package com.example.hasee.usersetting;

import com.example.hasee.data.DataStore;
import com.example.hasee.data.entity.Student;

public class UserSettingPresenter implements UserSettingContract.Presenter{
    private UserSettingContract.View rootView;
    private DataStore mDateStore;
    public UserSettingPresenter(UserSettingContract.View rootView) {
        this.rootView = rootView;
        mDateStore=DataStore.getINSTANCE();
    }
    @Override
    public void updateStudentInfo(String sid, String grade) {
        Student student=mDateStore.getCurrentStudent();
        student.setSid(sid);
        student.setGrade(grade);
        mDateStore.updateUser(student);
        rootView.showStudentInfo(student);
    }

    @Override
    public void getStudentInfo() {
        rootView.showStudentInfo(mDateStore.getCurrentStudent());
    }
}
